- action = current_action?(:edit) || current_action?(:update) ? 'edit' : 'create'
- file_name = params[:id].split("/").last ||= ""
- is_markdown = Gitlab::MarkupHelper.gitlab_markdown?(file_name)

.file-holder.file.gl-mb-3
  .js-file-title.file-title.gl-display-flex.gl-align-items-center.gl-rounded-top-base{ data: { current_action: action } }
    .editor-ref.block-truncated.has-tooltip{ title: ref }
      = sprite_icon('branch', size: 12)
      = ref
    - if current_action?(:edit) || current_action?(:update)
      %span.float-left.gl-mr-3
      = text_field_tag 'file_path', (params[:file_path] || @path),
        class: 'form-control gl-form-input new-file-path js-file-path-name-input'
      = render 'template_selectors'

    - if current_action?(:new) || current_action?(:create)
      %span.float-left.gl-mr-3
        \/
      = text_field_tag 'file_name', params[:file_name], placeholder: "Filename", data: { qa_selector: 'file_name_field' },
        required: true, class: 'form-control gl-form-input new-file-name js-file-path-name-input', value: params[:file_name] || (should_suggest_gitlab_ci_yml? ? '.gitlab-ci.yml' : '')
      = render 'template_selectors'
      - if should_suggest_gitlab_ci_yml?
        .js-suggest-gitlab-ci-yml{ data: { target: '#gitlab-ci-yml-selector',
          track_label: 'suggest_gitlab_ci_yml',
          merge_request_path: params[:mr_path],
          dismiss_key: @project.id,
          human_access: human_access } }

    - if Feature.enabled?(:source_editor_toolbar, current_user)
      #editor-toolbar

    - else
      .file-buttons.gl-display-flex.gl-align-items-center.gl-justify-content-end
        - if is_markdown
          .md-header.gl-display-flex.gl-px-2.gl-rounded-base.gl-mx-2.gl-mt-2
            .gl-display-flex.gl-align-items-center.gl-flex-wrap.gl-justify-content-space-between
              .md-header-toolbar.gl-display-flex.gl-py-2.gl-flex-wrap{ class: "gl-m-0!" }
                = render 'shared/blob/markdown_buttons', supports_file_upload: false
        %span.soft-wrap-toggle
          = render Pajamas::ButtonComponent.new(icon: 'soft-unwrap', button_options: { class: 'no-wrap' }) do
            = _("No wrap")
          = render Pajamas::ButtonComponent.new(icon: 'soft-wrap', button_options: { class: 'soft-wrap' }) do
            = _("Soft wrap")

  .file-editor.code
    .js-edit-mode-pane#editor{ data: { 'editor-loading': true, qa_selector: 'source_editor_preview_container' } }<
      %pre.editor-loading-content= params[:content] || local_assigns[:blob_data]
    - if local_assigns[:path]
      .js-edit-mode-pane#preview.hide
        .center
          = gl_loading_icon(size: 'lg')
